using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMDetalleIngreso
    {
        public BMDetalleIngreso(string coneccion) 
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private DetalleIngreso oDetalleIngreso = new DetalleIngreso();
        private List<DetalleIngreso> listaDetalleIngreso = new List<DetalleIngreso>();
        private DADetalleIngreso daDetalleIngreso = new DADetalleIngreso();

        #region BMDetalleIngresoSearch
        public List<DetalleIngreso> BMDetalleIngresoSearch(DetalleIngreso detalleD, DetalleIngreso detalleH)
        {
            try
            {
                listaDetalleIngreso = new List<DetalleIngreso>();
                listaDetalleIngreso = daDetalleIngreso.DADetalleIngresoSearch(connection, detalleD, detalleH);

                return listaDetalleIngreso;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMDetalleIngresoInsert
        public void BMDetalleIngresoInsert(DetalleIngreso detalle)
        {
            try
            {
                daDetalleIngreso.DADetalleIngresoInsert(connection, detalle);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion
    }
}
